<template>
  <div class="box">
    <el-breadcrumb separator=">">
      <el-breadcrumb-item to="/login" replace>首页</el-breadcrumb-item>
      <el-breadcrumb-item to="/login/system" replace>系统管理</el-breadcrumb-item>
      <el-breadcrumb-item>公共消息设置</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="tableBox">
      <div class="tableTitle">公共消息设置</div>
      <div class="searchBox">
        <el-form size="mini" inline>
          <div class="block">
            <el-form-item>
              <el-button type="primary" icon="el-icon-circle-plus" @click="addInfo">新增</el-button>
            </el-form-item>
          </div>
        </el-form>
      </div>
      <el-table :data="tableData">
        <el-table-column prop="" label="公共消息编号" align="center"></el-table-column>
        <el-table-column prop="" label="公共消息标题" align="center"></el-table-column>
        <el-table-column prop="" label="公共消息内容" align="center"></el-table-column>
        <el-table-column prop="" label="当前状态" align="center"></el-table-column>
        <el-table-column prop="" label="创建时间" align="center"></el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="data">
            <el-button type="primary" size="mini" @click="deletes(data.row)">设置无效</el-button>
            <el-button type="primary" size="mini" @click="edit(data.row)">编辑</el-button>
            <el-button type="primary" size="mini" @click="sendShopInfo(data.row)">发送商户版信息</el-button>
            <el-button type="primary" size="mini" @click="sendUserInfo(data.row)">发送商户版信息</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="addInfo" v-if="showAddInfo">
        <el-form size="mini" :model="publicInfo">
          <el-form-item label="标题">
            <el-input v-model="publicInfo.title"></el-input>
          </el-form-item>
          <el-form-item label="消息内容">
            <el-input v-model="publicInfo.content"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">提交</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
  export default {
    name: 'publicInfoSet',
    data () {
      return {
        tableData: [],
        publicInfo: {},
        showAddInfo: false
      }
    },
    created () {
    },
    methods: {
      deletes (item) {
      },
      sendShopInfo (item) {
      },
      sendUserInfo (item) {
      },
      onSubmit () {
      },
      edit (item) {
        this.publicInfo = item
        this.showAddInfo = !this.showAddInfo
      },
      addInfo () {
        this.publicInfo = {}
        this.showAddInfo = !this.showAddInfo
      }
    },
    components: {}
  }
</script>

<style lang="less" ref="stylesheet/less" scoped>
  .addInfo {
    padding: 20px 20px 0;

    .el-form {
      .el-form-item {
        .el-input {
          width: 20%;
        }
      }
    }
  }
</style>
